package com.msk.web.controller.wlhy.shipperSupplierRelation;

import com.msk.base.service.goods.BaseDistanceService;
import com.msk.base.service.shipperSupplierRelation.BizShipperSupplierRelationshipService;
import com.msk.common.core.controller.BaseController;
import com.msk.common.core.domain.R;
import com.msk.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@Api(tags = "运距接口")
@RestController
@RequestMapping("/api/shipperSupplierRelationship")
public class BizShipperSupplierRelationshipController extends BaseController {

    @Autowired
    private BizShipperSupplierRelationshipService bizShipperSupplierRelationshipService ;

    /**
     * @Description 查询货主关联的承运商
     * @Author wlxiang
     * @Date 15:37 2023/6/7
     * @Param
     * @param params
     * @return com.msk.common.core.domain.R<?>
     **/
    @ApiOperation("查询货主关联的承运商")
    @PostMapping("/getSupplierInfoList")
    public R<?> getSupplierInfoList(@RequestBody Map<String,Object> params) {
        String shipperId = StringUtils.getString(params.get("shipperId"));
        if(StringUtils.isBlank(shipperId)){
            return R.appFail(400101, "请求参数货主ID#shipperId为空");
        }
        List<Map<String,Object>> supplierInfoList = bizShipperSupplierRelationshipService.selectSupplierInfoListByShipperId(shipperId);
        return R.appOk(supplierInfoList);
    }
}
